<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="电影搜索,电影查询" />
	<meta name="description" content="${key}" />
	<link href="/css/style.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" language="javascript" src="/js/jquery-1.6.1.min.js"></script>
	<script type="text/javascript" language="javascript" src="/js/tool.js"></script>
	<title>${key}<c:if test="${key != ''}">_搜索 - </c:if>琥珀川 · 高清影视网</title>
	<style type="text/css">
		<%--选项Div--%>
		.optionDiv{
			line-height:30px;
		}
		<%--选项Div font--%>
		.optionDiv font{
			color:#444444;
			font-weight:bold;
			font-size:14px;
			float:right;
		}
		<%--选中的A--%>
		.onSelectA{
			color:white;
			background-color:#09F;
			text-decoration:none;
			padding-left:8px;
			padding-right:8px;
			font-size:14px;
			white-space:nowrap;
		}
		<%--没有选中的A--%>
		.notSelectA{
			color:#666666;
			text-decoration:none;
			padding-left:8px;
			padding-right:8px;
			font-size:14px;
			white-space:nowrap;
		}
		.notSelectA:hover{
			color:#09F;
			background-color:#DBE7F9;
		}
		<%--电影Div 名称A--%>
		.movieDiv .nameA{
			color:#444444;
			font-size:14px;
			font-weight:bold;
			text-decoration:none;
		}
		.movieDiv .nameA:hover{
			color:#09F;
		}
		<%--电影Div 别名A--%>
		.movieDiv .bynameA{
			color:#AAAAAA;
			font-size:12px;
			font-weight:bold;
			text-decoration:none;
		}
		.movieDiv .bynameA:hover{
			color:#09F;
		}
		<%--本周排行榜前三Div--%>
		.tswkListTop3{
			background-color:#FA6470; 
			color:white; 
			width:20px; 
			line-height:20px; 
			text-align:center; 
			font-weight:bold; 
			margin-right:10px;
		}
		<%--本周排行榜非前三Div--%>
		.tswkListNotTop3{
			background-color:white; 
			color:#666; 
			width:20px; 
			line-height:20px; 
			text-align:center; 
			font-weight:bold; 
			margin-right:10px;
		}
		<%--没选中页号的样式A--%>
		.pageNumA{
			border:1px solid #A6C5ED; 
			color:#659BE9;
			padding-top:3px; 
			padding-bottom:3px; 
			padding-left:10px; 
			padding-right:10px; 
			font-size:12px; 
			text-decoration:none;
		}
		.pageNumA:hover{
			color:white;
			background-color:#A6C5ED;
		}
		<%--选中页号的样式A--%>
		.pageNoA{
			border:1px solid #558BD9; 
			background-color:#558BD9;
			color:white; 
			padding-top:3px; 
			padding-bottom:3px; 
			padding-left:10px; 
			padding-right:10px; 
			font-size:12px; 
			text-decoration:none;
		}
	</style>
</head>

<body>
<jsp:include page="/include/pageTop" flush="true"/>
<%--背景渐变模块--%>
<div class="rowDiv" style="background-image:url(/image/system/backgroundChange.png); height:40px;"></div>
<div class="rowDiv" style="border-bottom:1px solid #09F;">
	<div class="standardDiv">
		<font style="font-weight:bold; margin-left:5px; font-size:16px; color:#333;">筛选条件</font>
	</div>
</div>
<div class="rowDiv">
	<div class="standardDiv">
		<div class="optionDiv">
			<div style="width:50px;">
				<font>年代：</font>
			</div>
			<div style="width:950px;">
				<A 
					<c:choose>  
						<c:when test="${yearId == 0}">class="onSelectA" href="#"</c:when>
						<c:otherwise>class="notSelectA" href="javascript:clickYear()"</c:otherwise>
					</c:choose>
				>全部</A>
				<c:forEach items="${yearList}" var="aYear">
					<A
						<c:choose>  
							<c:when test="${aYear.id == yearId}">class="onSelectA" href="#"</c:when>
							<c:otherwise>class="notSelectA" href="javascript:clickYear(${aYear.id})" title="点击查看 ${aYear.name} 的电影"</c:otherwise>
						</c:choose>
					>${aYear.name}</A>
				</c:forEach>
			</div>
		</div>
		<div class="optionDiv">
			<div style="width:50px;">
				<font>地区：</font>
			</div>
			<div style="width:950px;">
				<A
					<c:choose>  
						<c:when test="${areaSortId == 0}">class="onSelectA" href="#"</c:when>
						<c:otherwise>class="notSelectA" href="javascript:clickAreaSort(0)"</c:otherwise>
					</c:choose> 
				>全部</A>
				<c:forEach items="${areaSortList}" var="aAreaSort">
					<A
						<c:choose>  
							<c:when test="${areaSortId == aAreaSort.id}">class="onSelectA" href="#"</c:when>
							<c:otherwise>class="notSelectA" href="javascript:clickAreaSort(${aAreaSort.id})" title="点击查看 ${aAreaSort.name} 的电影"</c:otherwise>
						</c:choose>  
					>${aAreaSort.name}</A>
				</c:forEach>
			</div>
		</div>
		<div class="optionDiv">
			<div style="width:50px;">
				<font>类型：</font>
			</div>
			<div style="width:950px;">
				<A
					<c:choose>  
						<c:when test="${typeId == 0}">class="onSelectA" href="#"</c:when>
						<c:otherwise>class="notSelectA" href="javascript:clickType(0)"</c:otherwise>
					</c:choose>  
				>全部</A>
				<c:forEach items="${typeList}" var="aType">
					<A
						<c:choose>  
							<c:when test="${typeId == aType.id}">class="onSelectA" href="#"</c:when>
							<c:otherwise>class="notSelectA" href="javascript:clickType(${aType.id})" title="点击查看 ${aType.name} 类型电影"</c:otherwise>
						</c:choose> 
					>${aType.name}</A>
				</c:forEach>
				
			</div>
		</div>
		<div class="optionDiv">
			<div style="width:50px;">
				<font>导演：</font>
			</div>
			<div style="width:950px;">
				<A 
					<c:choose>  
						<c:when test="${directorId == 0}">class="onSelectA" href="#"</c:when>
						<c:otherwise>class="notSelectA" href="javascript:clickDirector(0)"</c:otherwise>
					</c:choose>  
				>全部</A>
				<c:forEach items="${directorList}" var="aDirector">
					<A
						<c:choose>  
							<c:when test="${directorId == aDirector.id}">class="onSelectA" href="#"</c:when>
							<c:otherwise>class="notSelectA" href="javascript:clickDirector(${aDirector.id})" title="点击查看 ${aDirector.name} 导演电影"</c:otherwise>
						</c:choose> 
					>
						<%--最大长度为5--%>
						<c:choose>
							<c:when test="${fn:length(aDirector.name) > 5}">
								${fn:substring(aDirector.name,0,4)}..
							</c:when>
							<c:otherwise>
								${aDirector.name}
							</c:otherwise>
						</c:choose>
					</A>
				</c:forEach>
			</div>
		</div>
		<div class="optionDiv">
			<div style="width:50px;">
				<font>演员：</font>
			</div>
			<div style="width:950px;">
				<A 
					<c:choose>  
						<c:when test="${actorId == 0}">class="onSelectA" href="#"</c:when>
						<c:otherwise>class="notSelectA" href="javascript:clickActor(0)"</c:otherwise>
					</c:choose>  
				>全部</A>
				<c:forEach items="${actorList}" var="aActor">
					<A
						<c:choose>  
							<c:when test="${actorId == aActor.id}">class="onSelectA" href="#"</c:when>
							<c:otherwise>class="notSelectA" href="javascript:clickActor(${aActor.id})" title="点击查看 ${aActor.name} 参演电影"</c:otherwise>
						</c:choose> 
					>
						<%--最大长度为5--%>
						<c:choose>
							<c:when test="${fn:length(aActor.name) > 5}">
								${fn:substring(aActor.name,0,4)}..
							</c:when>
							<c:otherwise>
								${aActor.name}
							</c:otherwise>
						</c:choose>
					</A>
				</c:forEach>
			</div>
		</div>
	</div>
</div>
<%--主体部分--%>
<div class="standardDiv">
	<div style="width:1000px; border:1px solid #EEE; background-color:white; margin-top:20px; padding-bottom:30px;">
		<div style="margin-top:20px;">
			<font style="margin-left:15px; font-size:12px; color:#AAA">共有&nbsp;<font style="color:red">${infoCount}</font>&nbsp;个符合条件的内容</font>
		</div>
		<div style="margin-top:10px;">
			<%--主体左Div--%>
			<div style="width:750px; margin-left:20px;">
				<c:choose>  
					<c:when test="${infoCount == 0}">
						<div style="padding-left:100px;">
							<div style="width:160px;">
								<img src="/image/system/cry.gif" style="width:150px;"/>
							</div>
							<div style="width:500px;">
								<div style="margin-top:50px;">
									<font style="font-weight:bold; font-size:14px;">没有找到<c:if test="${key != ''}">与“<font style="color:#F60;">${key}</font>”</c:if>相关的电影</font>
								</div>
								<div style="margin-top:20px;">
									<A style="color:#09F; border:1px solid #09F; padding-left:5px; padding-right:5px; text-decoration:none;" 
										href="/movieList"
									>重新筛选</A>
									<A style="margin-left:5px; color:#09F; border:1px solid #09F; padding-left:5px; padding-right:5px; text-decoration:none;" 
										href="javascript:clickfeedBack('我想找的电影是《${key}》')"
									>我想找的电影是....</A>
								</div>
							</div>
						</div>
					</c:when>
					<c:otherwise>
						<%--电影模块--%>
						<div class="movieDiv">
							<c:forEach items="${movieList}" var="aMovie">
								<div style="width:140px; margin-right:10px;">
									<A href="/movie/${aMovie.id}" target="_blank" title="点击查看电影 ${aMovie.name}">
										<%--带边框的海报图片--%>
										<div style="width:138px; border:1px solid #EEE;">
											<div style="width:136px; border:1px solid #DDD;">
												<div style="width:134px; border:1px solid #CCC; height:178px; overflow:hidden;">
													<img 
														<c:choose>
															<c:when test="${aMovie.logoPath == ''}">
																src="/image/system/defaultMovieLogo.png"
															</c:when>
															<c:otherwise> 
																src="${aMovie.logoPath}"
															</c:otherwise>
														</c:choose>
													style="border:0px; width:134px;"/>
												</div>
											</div>
										</div>
									</A>
									<%--电影名中该变红的关键字--%>
									<c:set var="redKey" value="<font style='color:#F0502A;'>${key}</font>"></c:set>
									<div style="text-align:center; height:50px;">
										<div style="margin-top:5px;">
											<A href="/movie/${aMovie.id}" target="_blank" class="nameA" title="${aMovie.name}">${fn:replace(aMovie.name,key,redKey)}</A>
										</div>
										<div>
											<A href="/movie/${aMovie.id}" target="_blank" class="bynameA" title="${aMovie.byname}">${fn:replace(aMovie.byname,key,redKey)}</A>
										</div>
									</div>
								</div>
							</c:forEach>
						</div>
						<div style="text-align:center; margin-top:30px;">
							<%--当前不是第一页--%>
							<c:if test="${pageNo != 1}">
								<A class="pageNumA" href="javascript:clickPageNo(${pageNo - 1})" title="上一页">上一页</A>&nbsp;
							</c:if>
							<c:if test="${pageNo >= 5}">
								<A class="pageNumA" href="javascript:clickPageNo(1)" title="第1页">1</A>&nbsp;
								<c:if test="${pageNo > 5}">...</c:if>
							</c:if>
							<c:forEach var="i" varStatus="status" begin="0" end="6">
								<%--当前要打印的页号--%>
								<c:set var="pageNum" value="${pageNo - 3 + i}"></c:set>
								<c:if test="${pageNum >= 1 && pageNum <= pageCount}">
									<A
										<c:choose>  
											<c:when test="${pageNo == pageNum}">class="pageNoA" href="#"</c:when>
											<c:otherwise>class="pageNumA" href="javascript:clickPageNo(${pageNum})"</c:otherwise>
										</c:choose> 
									title="第${pageNum}页">${pageNum}</A>&nbsp;
								</c:if>
							</c:forEach>
							<c:if test="${pageNo <= pageCount - 5}">
								<c:if test="${pageNo < pageCount - 5}">...</c:if>
								<A class="pageNumA" href="javascript:clickPageNo(${pageCount})" title="第${pageCount}页">${pageCount}</A>&nbsp;
							</c:if>
							<%--当前不是最后一页--%>
							<c:if test="${pageNo != pageCount}">
								<A class="pageNumA" href="javascript:clickPageNo(${pageNo + 1})" title="下一页">下一页</A>&nbsp;
							</c:if>
						</div>
					</c:otherwise>
				</c:choose>
			</div>
			<%--主体右Div--%>
			<div style="margin-left:8px; width:200px;">
				<div style="border:1px solid #DDD;">
					<div style="margin-top:5px; width:170px; border-bottom:1px solid #FA6470; padding-left:15px;">
						<div style="width:35px;"><img src="/image/system/star.png"/></div>
						<div style="width:130px; line-height:35px; font-size:16px; font-weight:bold; color:#333333">本周排行榜</div>
					</div>
					<div style="margin-top:5px; width:170px; border-bottom:1px solid #FA6470; padding-left:15px; margin-bottom:10px; padding-bottom:10px;">
						<c:forEach items="${tswkList}" varStatus="status" var="aTswk">
							<div style="line-height:20px; margin-top:10px; font-size:14px;">
								<div
									<c:choose>  
										<c:when test="${status.count < 4}">class="tswkListTop3"</c:when>
										<c:otherwise>class="tswkListNotTop3"</c:otherwise>
									</c:choose>
								>${status.count}</div> 
								<A href="/movie/${aTswk.id}" style="color:#333333; text-decoration:none;" target="_blank" title="点击查看电影 ${aTswk.name}">${aTswk.name}</A>
							</div>
						</c:forEach>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<jsp:include page="/include/pageBottom" flush="true"/>
</body>
<script type="text/javascript">
	<%--点击年代--%>
	function clickYear(id){
		$("#yearId").val(id);
		<%--初始化页号--%>
		$("#pageNo").val(1);
		<%--提交搜索--%>
		submitSearch();
	}
	<%--点击地区分类--%>
	function clickAreaSort(id){
		$("#areaSortId").val(id);
		<%--初始化页号--%>
		$("#pageNo").val(1);
		<%--提交搜索--%>
		submitSearch();
	}
	<%--点击类型--%>
	function clickType(id){
		$("#typeId").val(id);
		<%--初始化页号--%>
		$("#pageNo").val(1);
		<%--提交搜索--%>
		submitSearch();
	}
	<%--点击导演--%>
	function clickDirector(id){
		$("#directorId").val(id);
		<%--初始化页号--%>
		$("#pageNo").val(1);
		<%--提交搜索--%>
		submitSearch();
	}
	<%--点击演员--%>
	function clickActor(id){
		$("#actorId").val(id);
		<%--初始化页号--%>
		$("#pageNo").val(1);
		<%--提交搜索--%>
		submitSearch();
	}
	<%--点击页号--%>
	function clickPageNo(no){
		$("#pageNo").val(no);
		<%--提交搜索--%>
		submitSearch();
	}
</script>
</html>
